package cn.rjzjh.tapestry.busi.model.ca;

// Generated 2014-9-6 10:25:55 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CaRole generated by hbm2java
 */
@Entity
@Table(name = "CA_Role")
public class CaRole implements java.io.Serializable {

	private int id;
	private String roleName;
	private String isValid;
	private String remark;
	private Set<CaRoleAssign> caRoleAssigns = new HashSet<CaRoleAssign>(0);//角色被赋给的对象（有职位、群组、组织等）
	private Set<CaRoleRes> caRoleReses = new HashSet<CaRoleRes>(0);//角色被分派的资源

	public CaRole() {
	}

	public CaRole(int id) {
		this.id=id;
	}

	public CaRole(int id, String roleName, String isValid) {
		this.id = id;
		this.roleName = roleName;
		this.isValid = isValid;
	}

	public CaRole(int id, String roleName, String isValid, String remark,
			Set<CaRoleAssign> caRoleAssigns, Set<CaRoleRes> caRoleReses) {
		this.id = id;
		this.roleName = roleName;
		this.isValid = isValid;
		this.remark = remark;
		this.caRoleAssigns = caRoleAssigns;
		this.caRoleReses = caRoleReses;
	}

	@Id()
	@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "roleName", nullable = false, length = 50)
	public String getRoleName() {
		return this.roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	@Column(name = "isValid",length = 10)
	public String getIsValid() {
		return this.isValid;
	}

	public void setIsValid(String isValid) {
		this.isValid = isValid;
	}

	@Column(name = "remark", length = 2000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caRole",cascade = { CascadeType.REMOVE })
	public Set<CaRoleAssign> getCaRoleAssigns() {
		return this.caRoleAssigns;
	}

	public void setCaRoleAssigns(Set<CaRoleAssign> caRoleAssigns) {
		this.caRoleAssigns = caRoleAssigns;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caRole",cascade = { CascadeType.REMOVE })
	public Set<CaRoleRes> getCaRoleReses() {
		return this.caRoleReses;
	}

	public void setCaRoleReses(Set<CaRoleRes> caRoleReses) {
		this.caRoleReses = caRoleReses;
	}

}
